package com.loong.musicdemo.ui.playsong;

import android.content.Context;

import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.loong.musicdemo.R;

/**
 * 播放列表适配器,用于viewPager
 */
public class SongListPagerAdapter extends FragmentPagerAdapter {
    private final Context context;

    public SongListPagerAdapter(Context context, @NonNull FragmentManager fm) {
        super(fm);
        this.context = context;
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return position == 0 ? PageHistoryFragment.newInstance() : PageLocalFragment.newInstance();
    }

    @Override
    public int getCount() {
        return 2;
    }

    @Override
    public float getPageWidth(int position) {
        return (float) 0.95;
    }
}
